package CutLoad.cookies
{
	/**
	 * 一些正则表达式的整理
	 * @author smallerbird mail:smallerbird@gmail.com  site:www.mkigm.com QQ群:49983196
	 * 
	 */
	public class RegExpFun
	{
		/**
		 * 清除首尾换行符
		 * @param src
		 * @return 
		 * 
		 */		
		public static function clearHeadTailLine(src:String):String{
			src=src.replace(/^\n*/g,"");
			src=src.replace(/\n*$/g,"");
			return src;
		}
		/**
		 * 清除首尾空白
		 * @param src
		 * @return 
		 * 
		 */		
		public static function clearHeadTailSpace(src:String):String{
			src=src.replace(/^\g*/g,"");
			src=src.replace(/\g*$/g,"");
			return src;
		}
		/**
		 * 检测email格式是否正确 
		 * @param str
		 * @return 
		 * 
		 */		
		public static function isEmail(str:String):Boolean{
			var regex:RegExp=new RegExp("^[\\w-]+(\\.[\\w-]+)*@[\\w-]+(\\.[\\w-]+)+$"); 
			return regex.exec(str);
		}
	}
}